﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace bigormscreensaver
{
    public partial class AppForm : Form
    {
        private Settings settings;
        public AppForm(Settings settings)
        {
            this.settings = settings;
            InitializeComponent();
        }

        private void buttonInstall_Click(object sender, EventArgs e)
        {
            string sCmdRes;
            string sRes = "Copy file \"" + Util.File_Executable +"\" to \"" + Util.File_Destination64 + "\" ";
            if (Util.FileCopy(Util.File_Executable, Util.File_Destination64, true, out sCmdRes))
                sRes += sCmdRes;
            else
            {
                sRes += sCmdRes + ", attempt \"" + Util.File_Destination32 + "\" ";
                Util.FileCopy(Application.ExecutablePath, Util.File_Destination32, true, out sCmdRes);
                sRes += sCmdRes;
            }
            Util.FileOpenScreensaverSettings();
            labelInstall.Text = sRes;
        }

        private void buttonUninstall_Click(object sender, EventArgs e)
        {
            string sCmdRes;
            string sRes = "Delete file \"" + Util.File_Destination32 + "\" ";
            Util.FileDelete(Util.File_Destination32, true, out sCmdRes);
            sRes += sCmdRes + ", file \"" + Util.File_Destination64 + "\" ";
            Util.FileDelete(Util.File_Destination64, true, out sCmdRes);
            sRes += sCmdRes;
            labelUninstall.Text = sRes;
        }

        private void buttonSettings_Click(object sender, EventArgs e)
        {
            SettingsForm fSettings = new SettingsForm(settings);
            fSettings.ShowDialog();
            labelSettings.Text = fSettings.ToString();
        }
    }
}
